local tifeng = fk.CreateSkill{
    name = "lingling__tifeng"
}
Fk:loadTranslationTable{
    ["lingling__tifeng"] = "题讽",
    [":lingling__tifeng"] = "每回合限一次，当一名你与其距离为1以内的角色受到伤害后，你可以将一张与造成伤害的牌花色相同的牌当【无中生有】使用，若其不为你，其弃置一张牌。",
    ["#lingling__tifeng"] = "题讽：你可以将一张 %arg 牌当【无中生有】使用",
}

tifeng:addEffect(fk.Damaged,{
    can_trigger = function (self, event, target, player, data)
        return player:hasSkill(tifeng.name) and not player:isNude() and player:distanceTo(target) < 2 and data.card and data.card:getSuitString() ~= "nosuit" and player:usedSkillTimes(tifeng.name, Player.HistoryTurn) < 1
    end,
    on_cost = function (self, event, target, player, data)
        local suit = data.card:getSuitString()
        local use = player.room:askToUseVirtualCard(player,{
            name = "ex_nihilo",
            skill_name = tifeng.name,
            skip = true,
            cancelable = true,
            card_filter = {
                n = 1,
                pattern = ".|.|"..suit,
            },
            prompt = "#lingling__tifeng:::"..data.card:toLogString(true)
        })
        if use then
            event:setCostData(self, use)
            return true
        end
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        room:useCard(event:getCostData(self))
        if target ~= player and not target.dead and not target:isNude() then
            room:askToDiscard(target,{
                max_num = 1,
                min_num = 1,
                skill_name = tifeng.name,
                cancelable = false,
            })
        end
    end,
})

return tifeng